package com.web;

import com.pojo.XiangQing_db;
import com.service.XiangQingService_db;
import com.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/xiangqing")

public class XiangQingController_db {
    @Autowired
    private XiangQingService_db xiangQingServiceDb;

    @RequestMapping("/all")
    public ResultEntity listAll(){
        return ResultEntity.ok(xiangQingServiceDb.listAll());
    }

    @RequestMapping("/findid")
    public ResultEntity findById(Integer xKid){
        return ResultEntity.ok(xiangQingServiceDb.findById(xKid));
    }

    @RequestMapping("/add")
    public ResultEntity add(XiangQing_db xiangQingDb){
        return ResultEntity.ok(xiangQingServiceDb.add(xiangQingDb));
    }

    @RequestMapping("/update")
    public ResultEntity update(XiangQing_db xiangQingDb){
        return ResultEntity.ok(xiangQingServiceDb.update(xiangQingDb));
    }

    @RequestMapping("/delete")
    public ResultEntity del(Integer xId){
        return ResultEntity.ok(xiangQingServiceDb.del(xId));
    }
}
